//
//  main.cpp
//  类的成员函数
//
//  Created by linjinzhu on 2017/7/11.
//  Copyright © 2017年 baidu. All rights reserved.
//

#include <iostream>

using namespace std;


/// 内部定义成员函数
class Box {

public:
    double length;
    double height;
    double width;

    // 返回体积
    double volume() {
        return length * height * width;
    }

    void setLength(double l) {
        length = l;
    }
};

/// 外部定义成员函数
class BigBox {

public:
    double length;
    double height;
    double width;

    double volume();// 返回体积
};

double BigBox::volume() {
    return length * height * width * 2;
}


int main(int argc, const char * argv[]) {

    Box b;


    b.length = 1;
    b.width = 2;
    b.height = 3;
    cout << b.volume() << endl;

    BigBox bb;
    bb.length = 1;
    bb.width = 2;
    bb.height = 3;
    cout << bb.volume() << endl;

    return 0;
}
